package com.ghsc.ghxc.jsb.ui.my

import androidx.lifecycle.MutableLiveData
import com.cn.appcore.base.BaseViewModel
import com.cn.appcore.ext.executeResponse
import com.cn.appcore.http.bean.BaseResponse
import com.ghsc.ghxc.jsb.api.ApiMarket
import com.ghsc.ghxc.jsb.ui.my.bean.UserResultDataBean
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.my
 * 类名：MyViewModel
 * 创建时间：2024/4/23 15:04
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class MyViewModel  : BaseViewModel() {


    /**
     * 个人中心
     */
    val onUserInfoData: MutableLiveData<BaseResponse<UserResultDataBean>> = MutableLiveData()
    fun onUserInfoMethod() {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onUserInfoData() }
            executeResponse(
                response,
                { onUserInfoData.value = response },
                { againLoginMsg.value = response.msg }
            ) { errorMsg.value = response.msg }
        }

    }

}